#coding:utf-8

class tags:
    def __init__(self):
        pass

    def add_tags(self):
            Flag = 1
            while Flag:
                tag_name = raw_input('请输入密码类型名称：')
                tag_item = raw_input('请输入新增密码类型的项目(以逗号间隔)：')
                for i in tags_type:
                    if i.get('tag') == tag_name:
                        print '存在'
                        break
                else:
                    tags_type.append({'tag':tag_name,'items':tag_item.split(',')})
                    print tags_type
                    break
            else:
                pass

    def update_tags(self):
        Flag = 1
        while Flag:
            tag_name = raw_input('请输入密码类型名称：')
            for i in tags_type:
                if i.get('tag') == tag_name:

                    Flag = 0
                    break
            else:
                print '不存在'
                continue
#

    def delete_tags(self):
        Flag = 1
        while Flag:
            tag_name = raw_input('请输入密码类型名称：')
            for i in tags_type:
                if i.get('tag') == tag_name:
                    tags_type.remove(i)
                    Flag = 0
                    break
            else:
                print '输入的分类不存在，请重新输入！'
                continue
